/*
    nspire-gamekit - a simple homebrew game framework
    Copyright (C) 2011  Daniel Tang

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCREEN_H
#define SCREEN_H

#include "types/ngk.h"

#ifdef __cplusplus
extern "C" {
#endif
#define SCREEN_WIDTH 320 /*Make sure this is an even number*/
#define SCREEN_HEIGHT 240

#define screenBufferColorGetAlphaValue(x) (x>>4)
#define screenBufferColorSetAlphaValue(x, y) ( ((x) & 0b00001111)  | ((y)<<4) )

NGKDimInt screenBufferWidth(const NGKScreenBuffer* screen);
NGKDimInt screenBufferHeight(const NGKScreenBuffer* screen);
void* screenBufferData(const NGKScreenBuffer* screen);

NGKScreenBuffer* screenBufferAlloc(NGKSize);
NGKScreenBuffer* screenBufferFromCopy(const NGKScreenBuffer* old);
void screenBufferDestroy(NGKScreenBuffer* screen);
void screenBufferDrawScreen(NGKPoint point, NGKScreenBuffer* src, NGKScreenBuffer* dest);
void screenBufferClear(char color, NGKScreenBuffer* screen);
char screenBufferGetPixel(NGKPoint point, NGKScreenBuffer* screen);
void screenBufferSetPixel(NGKPoint point, char color, NGKScreenBuffer* screen);
void screenBufferFlushToScreen(NGKScreenBuffer* screen);
#ifdef __cplusplus
}
#endif
#endif